OPENCV=opencv/

FLAGS=-I/usr/include/opencv#-I$(OPENCV)include -L$(OPENCV)lib
LIBS=-lcv -lcxcore -lhighgui -lm -lcvaux

all: clean Serial Glue Image

Serial:	simpleserialcommunication.c
	gcc simpleserialcommunication.c -o Serial

Image: vision.cpp
	g++ vision.cpp $(FLAGS) $(LIBS) -o vision

opencvtest:	displayimagetest.cpp displaycamera.cpp
	g++ displayimagetest.cpp $(FLAGS) $(LIBS) -o displayimagetest
	g++ displaycamera.cpp $(FLAGS) $(LIBS) -o displaycamera

Test: testMovement.c
	gcc testMovement.c -o TestMovement

vision.o: vision.cpp
	g++ $(FLAGS) $(LIBS) -c vision.cpp

Scorbot: driver.c commDriver.c queue.o
	gcc -g $(FLAGS) $(LIBS) commDriver.c driver.c queue.o -o Scorbot -lpthread

Glue: glue.o driver.o commDriver.o queue.o gotransformation.o vision2.o
	g++ -g $(FLAGS) $(LIBS) gotransformation.o commDriver.o driver.o glue.cpp vision2.o queue.o -o Glue -lpthread

glue.o:
	g++ -O3 -c glue.cpp
vision2.o:
	g++ -O3 -c $(FLAGS) $(LIBS) vision2.cpp

queue.o: queue.c
	gcc -O3 -c queue.c
commDriver.o: commDriver.c
	gcc -O3 -c commDriver.c
driver.o: driver.c
	gcc -O3 -c driver.c
gotransformation.o:
	gcc -O3 -c gotransformation.c

clean:
	rm -f Serial
	rm -f Scorbot
	rm -f opencvteset
	rm -f TestMovement
	rm -f *.o *~
